package ch.ethz.fcl.metrobuzz.controller.gui.popup;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class PopupMenuActionListener implements ActionListener {
	private MBPopupMenu menu;

	public PopupMenuActionListener(MBPopupMenu menu) {
		this.menu = menu;
	}

	@Override
	public void actionPerformed(ActionEvent event) {
		if (event.getActionCommand().equals(MBPopupMenu.exit))
			System.exit(0);
		else if (event.getActionCommand().equals(MBPopupMenu.zoomCenter)) {
			menu.updateCentroid(true);
			MBPopupMenu.centerSelected = true;
			MBPopupMenu.updateMenu = true;
		} else if (event.getActionCommand().equals(MBPopupMenu.cancleCenter)) {
			MBPopupMenu.centerSelected = false;
			MBPopupMenu.updateMenu = true;
		} else if (event.getActionCommand().equals(MBPopupMenu.temporalPattern)) {
			MBPopupMenu.showTemporalPattern = true;
		} else if (event.getActionCommand().equals(MBPopupMenu.detail)) {
			MBPopupMenu.DetailView = true;
			MBPopupMenu.updateMenu = true;
		} else if (event.getActionCommand().equals(MBPopupMenu.nodetail)) {
			MBPopupMenu.DetailView = false;
			MBPopupMenu.updateMenu = true;
		}
	}
}
